package com.pikaqiu.warehouse.utils;

import cn.hutool.core.date.DateUtil;

import java.util.Arrays;
import java.util.List;

/**
 * @Author: Administrator
 * @Date: 2024/7/23
 */
public class DateUtils extends DateUtil {

    public static final String DATE_FORMAT_CN = "MM月dd日";
    public static final String DATE_FORMAT_YEAR_MONTH_CN = "yyyy年MM月";
    public static final String DATE_FORMAT_YEAR_MONTH = "yyyy-MM";
    public static final String DATE_FORMAT_MONTH_CN = "MM月";
    public static final String DATE_FORMAT_MONTH__SINGLE_CN = "M月";
    public static final String DATE_FORMAT_YEAR_CN = "yyyy年";
    public static final String DATE_FORMAT_KOU_DAI = "yyyy/MM/dd";
    public static final String DATE_FORMAT_WE_CHAT = "yyyy/MM/dd HH:mm:ss";
    public static final List<String> MONTH_LIST = Arrays.asList("1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月");
    public static final List<String> MONTH_REVERSED_LIST = Arrays.asList("12月", "11月", "10月", "9月", "8月", "7月", "6月", "5月", "4月", "3月", "2月", "1月");

    /**
     * 判断字符串是否符合日期格式
     */
    public static boolean isMatch(String dateStr, String formatter) {
        try {
            parse(dateStr, formatter);
            return true;
        } catch (Exception e) {
            return false;
        }
    }
}
